home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 22
/
Cream of the Crop 22.iso
/
windows
/
wdj1096.zip
/
ZOLMAN.ZIP
/
WRAPOCX.H
< prev
next >
Wrap
C/C++ Source or Header
|
1996-07-23
|
979b
|
48 lines
//
//wrapocx.h
//
//A template for easy OCX reuse.
//this is for use with projects generated with AppWizard
#include "stdafx.h"
template <class OCX>
class COcxWrap
{
private:
OCX m_Ocx;
CWnd m_wnd;
public:
COcxWrap(UINT id);
~COcxWrap();
inline OCX& Ocx();
};
template <class OCX>
COcxWrap<OCX>::COcxWrap(UINT id) : m_wnd(), m_Ocx()
{
m_wnd.CreateEx(0, //extended styles
AfxRegisterWndClass(0), //new class
"ContainerWindow", //window name
WS_OVERLAPPED, //style
10,10,200,200, //position
0L, //hParent
0L); //hMenu
m_Ocx.Create(AfxRegisterWndClass(0), "OCX", 0, CRect(10,10,20,20), &m_wnd, id);
}
template <class OCX>
OCX& COcxWrap<OCX>::Ocx()
{
return m_Ocx;
}
template <class OCX>
COcxWrap<OCX>::~COcxWrap()
{
m_wnd.DestroyWindow();
}